package com.sinaapp.mrblog.game.Assasin.screen;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.sinaapp.mrblog.game.Assasin.Assasin;
import com.sinaapp.mrblog.game.Assasin.stage.GameStage;
import com.sinaapp.mrblog.game.Assasin.util.AssasinConst;
import com.sinaapp.mrblog.game.Assasin.util.AssasinManager;

public class StartScreen extends AssasinScreen {

	Stage stage;
	Image startImage;
	Image startButton;
	Image exitButton;

	@Override
	public void show() {
		stage = new Stage();
		startImage = new Image(AssasinManager.startRegion);
		startButton = new Image(AssasinManager.startButton);
		exitButton = new Image(AssasinManager.exitRegion);

		float w = Gdx.graphics.getWidth() / 4;
		float h = Gdx.graphics.getHeight() / 5;

		startButton.setPosition(w, h);
		exitButton.setScale(0.5f);
		

		setListener();
		stage.addActor(startImage);
		stage.addActor(startButton);
		stage.addActor(exitButton);
		Gdx.input.setInputProcessor(stage);

	}

	public StartScreen() {
		super();
		// TODO Auto-generated constructor stub
	}

	public void setListener() {
		startButton.addListener(new InputListener() {

			@Override
			public boolean touchDown(InputEvent event, float x, float y,
					int pointer, int button) {
				Assasin.state = Assasin.ASSASIN_STATE_CHOOSE;
				return true;
			}

		});
		
		exitButton.addListener(new InputListener() {

			@Override
			public boolean touchDown(InputEvent event, float x, float y,
					int pointer, int button) {
				Gdx.app.exit();
				return true;
			}

		});
	}

	@Override
	public void render(float delta) {
		Gdx.gl.glClearColor(1, 1, 1, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

		stage.act();
		stage.draw();

	}

}
